package com.insurance.modules.auth.controller;

import java.util.Arrays;
import java.util.Map;

import com.insurance.entity.AuthenticationUserEnterpriseEntity;
import com.insurance.service.AuthenticationUserEnterpriseService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.insurance.common.utils.PageUtils;
import com.insurance.common.utils.R;



/**
 * 用户企业关系表
 *
 * @date 2021-02-27 14:11:16
 */
@RestController
@RequestMapping("product/authenticationuserenterprise")
public class AuthenticationUserEnterpriseController {
    @Autowired
    private AuthenticationUserEnterpriseService authenticationUserEnterpriseService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("product:authenticationuserenterprise:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = authenticationUserEnterpriseService.queryPage(params);
        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{ueId}")
    @RequiresPermissions("product:authenticationuserenterprise:info")
    public R info(@PathVariable("ueId") String ueId){
		AuthenticationUserEnterpriseEntity authenticationUserEnterprise = authenticationUserEnterpriseService.getById(ueId);
        return R.ok().put("authenticationUserEnterprise", authenticationUserEnterprise);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("product:authenticationuserenterprise:save")
    public R save(@RequestBody AuthenticationUserEnterpriseEntity authenticationUserEnterprise){
		authenticationUserEnterpriseService.save(authenticationUserEnterprise);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("product:authenticationuserenterprise:update")
    public R update(@RequestBody AuthenticationUserEnterpriseEntity authenticationUserEnterprise){
		authenticationUserEnterpriseService.updateById(authenticationUserEnterprise);
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("product:authenticationuserenterprise:delete")
    public R delete(@RequestBody String[] ueIds){
		authenticationUserEnterpriseService.removeByIds(Arrays.asList(ueIds));
        return R.ok();
    }

}
